using System;
using UnityEngine;

[Serializable]
public class Credits : MonoBehaviour
{
	public Camera mainCamera;

	public MenuButtons3D menubuttons;

	public DevelopersFriend buybutton;

	public GameObject buttonSlide;

	public Collider updateButton;

	public Transform texts;

	private Vector2 pos;

	private string nam;

	public void Start()
	{
		menubuttons.enabled = false;
		buybutton.enabled = false;
	}

	public void Update()
	{
		if (Input.GetMouseButtonDown(0))
		{
			pos = UnityEngine.Input.mousePosition;
			RaycastHit hitInfo = default(RaycastHit);
			if (Physics.Raycast(mainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition), out hitInfo, 100f))
			{
				nam = hitInfo.collider.name;
			}
		}
		if (Input.GetMouseButtonUp(0))
		{
			Check();
		}
	}

	public void Check()
	{
		Vector3 mousePosition = UnityEngine.Input.mousePosition;
		if (mousePosition.x / pos.x <= 0.95f)
		{
			return;
		}
		Vector3 mousePosition2 = UnityEngine.Input.mousePosition;
		if (mousePosition2.x / pos.x >= 1.05f)
		{
			return;
		}
		Vector3 mousePosition3 = UnityEngine.Input.mousePosition;
		if (mousePosition3.y / pos.y <= 0.95f)
		{
			return;
		}
		Vector3 mousePosition4 = UnityEngine.Input.mousePosition;
		if (!(mousePosition4.y / pos.y >= 1.05f))
		{
			if (nam == "Cross")
			{
				gameObject.SetActiveRecursively(state: false);
			}
			else if (nam == "Special Thanks")
			{
				Application.OpenURL("http://makedev.fi");
			}
			else if (nam == "GameBy")
			{
				Application.OpenURL("http://miksumortti.com");
			}
		}
	}

	public void OnEnable()
	{
		StateManager.state = State.Credits;
		buttonSlide.SetActiveRecursively(state: false);
		updateButton.enabled = false;
		GameObject.Find("Tops").GetComponent<Collider>().enabled = false;
	}

	public void OnDisable()
	{
		GameObject.Find("Tops").GetComponent<Collider>().enabled = true;
		menubuttons.enabled = true;
		buybutton.enabled = true;
		StateManager.state = State.Neutral;
		buttonSlide.SetActiveRecursively(state: true);
		updateButton.enabled = true;
		texts.localPosition = new Vector3(0.5f, -10f, 7f);
	}

	public void Main()
	{
	}
}
